var MyHashSet = function () {
  this.set = []
};

/** 
 * @param {number} key
 * @return {void}
 */
MyHashSet.prototype.add = function (key) {
  this.set.push(key)
};

/** 
 * @param {number} key
 * @return {void}
 */
MyHashSet.prototype.remove = function (key) {
  for (let i = 0; i < this.set.length; i++) {
    if (this.set[i] === key) {
      this.set.splice(i, 1)
      return true
    }
  }
};

/** 
 * @param {number} key
 * @return {boolean}
 */
MyHashSet.prototype.contains = function (key) {
  for (let i = 0; i < this.set.length; i++) {
    return this.set[i] === key
  }
};
let myHashSet = new MyHashSet()
myHashSet.add(1)
myHashSet.add(2)
console.log(myHashSet.contains(1));
console.log(myHashSet.contains(3));
myHashSet.add(2)
console.log(myHashSet.contains(2));
myHashSet.remove(2)
console.log(myHashSet);
/**
 * Your MyHashSet object will be instantiated and called as such:
 * var obj = new MyHashSet()
 * obj.add(key)
 * obj.remove(key)
 * var param_3 = obj.contains(key)
 */